const Lrt = {};

(function () {
  // 随机整数
  function randomNum(max) {
    return Math.floor(Math.random() * max);
  }
  // 随机颜色
  function randomColor1() {
    const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e", "f"];
    // console.log(randomNum(16));
    let colorStr = "#";
    for (i = 0; i < 6; i++) {
      colorStr += arr[randomNum(16)];
    }
    return colorStr;
  }
  function randomColor2() {
    return `rgb(${Math.random() * 256}, ${Math.random() * 256}, ${
      Math.random() * 256
    })`;
  }
  function randomColor3() {
    return "#" + Math.random().toString(16).slice(2, 8);
  }
  function randomColor4() {
    return "#" + parseInt(Math.random() * 0xffffff).toString(16);
  }

  Lrt.randomColor1 = randomColor1;
  Lrt.randomColor2 = randomColor2;
  Lrt.randomColor3 = randomColor3;
  Lrt.randomColor4 = randomColor4;
  Lrt.randomNum = randomNum;
})(Lrt);
